CIS126RH | RHEL System Administration 1
Mesa Community College
Navigate between Normal, Insert, and Command modes
Open, edit, save, and exit files efficiently
Move, search, copy, paste, and delete text
Navigate nano as a simpler alternative editor
In Linux, configuration files are plain text. System administration means editing files in /etc, writing scripts, and modifying configurations - all through text editors.
Powerful, ubiquitous, available on every Unix system. Modal editing provides efficiency once learned. RHCSA exam standard.
Simple, intuitive, shows shortcuts on screen. Good for beginners and quick edits. Less powerful than vim.
vim available. Knowing vim is essential for completing exam tasks efficiently.
# On RHEL, vi is actually vim
ls -l /usr/bin/vi
lrwxrwxrwx. 1 root root 3 Nov 1 10:00 /usr/bin/vi -> vim
# Check vim version
vim --version | head -1
VIM - Vi IMproved 8.2
Modal editing means vim has different modes for different tasks. Keys do different things depending on the current mode.
# Open vim with a file
vim filename.txt
# Open vim without a file
vim
# Open at specific line number
vim +50 filename.txt # Opens at line 50
# Open in read-only mode
vim -R filename.txt
view filename.txt # Same as vim -R
| Key | Action | Use When |
|---|---|---|
| i | Insert before cursor | Most common - insert at current position |
| I | Insert at beginning of line | Adding content to start of line |
| a | Append after cursor | Adding after current character |
| A | Append at end of line | Adding content to end of line |
| o | Open new line below | Inserting a new line after current |
| O | Open new line above | Inserting a new line before current |
| Command | Action |
|---|---|
| x | Delete character under cursor |
| X | Delete character before cursor (backspace) |
| dd | Delete (cut) entire line |
| D | Delete from cursor to end of line |
| dw | Delete word from cursor |
| yy | Yank (copy) entire line |
| yw | Yank (copy) word |
| p | Paste after cursor |
| P | Paste before cursor |
| u | Undo last change |
| Ctrl+r | Redo (undo the undo) |
# Search forward (from